<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/"
  xmlns:o="http://xmlns.heustics.org/schema/myelin/0.1/NodeGrouping"
  exclude-result-prefixes="xsl l a o"
>  
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;NodeGrouping')"/> 
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/>  
  <!-- xsl:variable name="o:titles-l10n" select="$o:l10n/l:context[@name='titles']/*"/ -->
  
  <xsl:template match="a:node-grouping" mode="a:input-show"/>
  <xsl:template match="a:node-grouping" mode="a:hidden"/>
  
  <xsl:template match="a:ordering" mode="a:input-show">
    <xsl:call-template name="a:ordering-input-show">
      <xsl:with-param name="label" select="$o:params-l10n[@key='ordering']"/>
      <xsl:with-param name="hint" select="$o:hints-l10n[@key='ordering']"/>
    </xsl:call-template> 
  </xsl:template> 
  
  <xsl:template match="a:max-display-count" mode="a:input-show">        
    <div class='input text max-display-count'>  
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span><xsl:value-of select="$o:params-l10n[@key='max-display-count']"/></span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='max-display-count']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>      
      <div class='value'>
        <input class='small' type="text" value="{.}" name="max-display-count"/>
        <div class="spacer"/>
      </div>
      <div class='spacer'/>
    </div>
  </xsl:template>
  
  <xsl:template match="a:permitted-types[a:selection]" mode="a:input-hidden">
    <xsl:for-each select="a:selection/*">
      <input type="hidden" name="permitted-types" value="{@key}"/>
    </xsl:for-each>            
  </xsl:template>   
  
  <xsl:template match="a:permitted-types" mode="a:input-show" name="o:type">
    <div class="input select permitted-types">
      <div class="key">
        <div>
          <xsl:call-template name="a:label-class-attr"/>
          <span>
            <xsl:value-of select="$o:params-l10n[@key='permitted-types']"/>
          </span>
          <div class="spacer"/>
        </div>        
        <div class='hint'>
          <xsl:call-template name="a:input-hints">
            <xsl:with-param name="hint" select="$o:hints-l10n[@key='permitted-types']"/>
          </xsl:call-template>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>  
      <div class="value">
        <xsl:variable name="options" select="a:options"/>
        <xsl:choose>
          <xsl:when test="$options">
            <xsl:apply-templates select="a:options" mode="a:multiple-selection">
              <xsl:with-param name="name" select="'permitted-types'"/>
              <xsl:with-param name="selection" select="a:selection/*"/>
              <xsl:with-param name="header" select="$o:hints-l10n[@key='permitted-types-expanded']"/>
              <xsl:with-param name="l10n" select="a:get-l10n('&m;class-types')/l:context[@name='plural']/*"/>
            </xsl:apply-templates>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="a:input-hints">
              <xsl:with-param name="hint" select="$o:hints-l10n[@key='no-permitted-types']"/>
            </xsl:call-template>
          </xsl:otherwise>
        </xsl:choose>
        <div class="spacer"/>
      </div>    
      <div class="spacer"/>
    </div>
  </xsl:template>   
 
</xsl:stylesheet>

